Tracing ambiguity in GADT type inference

نویسندگان

  • Jacques Garrigue
  • Didier Rémy
چکیده

GADTs, short for Generalized Algebraic DataTypes, extend usual algebraic datatypes with a form of dependent typing that has many useful applications, but raises serious issues for type inference. Pattern matching on GADTs introduces type equalities with limited scopes, which are a source of ambiguities that may destroy principal types—and must be resolved by type annotations. By tracing ambiguities in types, we may tighten the definition of ambiguities and confine them, so as to request fewer type annotations. Now in use in OCaml 4.00, this solution also lifts some restrictions on object and polymorphic variant types that appeared in a previous implementation of GADTs in OCaml.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

GADT meet Subtyping

While generalized abstract datatypes (GADT) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in GAD...

متن کامل

GADT: A Probability Space ADT for Representing and Querying the Physical World

Large sensor networks are being widely deployed for measurement, detection, and monitoring applications. Many of these applications involve database systems to store and process data from the physical world. This data has inherent measurement uncertainties that are properly represented by continuous probability distribution functions (pdf’s). We introduce a new object-relational data type, the ...

متن کامل

A lean specification for GADTs: system F with first-class equality proofs

Generalized Algebraic Data Types are a generalization of Algebraic Data Types with additional type equality constraints. These found their use in many functional programs, including the development of embedded domain specific programming languages and generic programming. Recently, several authors published novel inference algorithms and corresponding type system specifications. These approache...

متن کامل

Generating an Efficient Dynamics Multicast Tree under Grid Environment

The use of an efficient multicast tree can substantially speed up many communication-intensive MPI applications. This is even more crucial for Grid environment since MPI runtime has to work on wide area network with very different and unbalanced network bandwidth. This paper proposes a new and efficient algorithm called, GADT (Genetics Algorithm based Dynamics Tree) that can be used to generate...

متن کامل

GADTs Meet Subtyping

While generalized algebraic datatypes (GADTs) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in G...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2012